<html>
<head><meta charset="utf-8"><title>region constraints · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html">region constraints</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="161483048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483048">(Mar 22 2019 at 20:55)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="131694">@scalexm</span> do you happen to be around? If so, do you have a link to what happens if you remove <a href="https://github.com/rust-lang/rust/blob/ed196221d889ae8a87be677402e4319237ef67f4/src/librustc_traits/chalk_context/mod.rs#L164-L168" target="_blank" title="https://github.com/rust-lang/rust/blob/ed196221d889ae8a87be677402e4319237ef67f4/src/librustc_traits/chalk_context/mod.rs#L164-L168">the FIXMEs and uncomment this code</a>?</p>



<a name="161483101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483101">(Mar 22 2019 at 20:56)</a>:</h4>
<p>Like, what prompted you to do that in the first place again?</p>



<a name="161483207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483207">(Mar 22 2019 at 20:57)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> this one is actually fine and I think I uncommented it in the fixup PR</p>



<a name="161483218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483218">(Mar 22 2019 at 20:57)</a>:</h4>
<p>Ah. Which one causes problems then?</p>



<a name="161483280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483280">(Mar 22 2019 at 20:58)</a>:</h4>
<p>It was just that, before that PR, we were not forwarding region constraints at all in <code>program_clauses_for</code>; now we do with the fixup PR</p>



<a name="161483306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483306">(Mar 22 2019 at 20:58)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> the ones that pose problem are those coming from unification</p>



<a name="161483368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483368">(Mar 22 2019 at 20:59)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> there is an helper function called <code>into_ex_clause</code> I think</p>



<a name="161483374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483374">(Mar 22 2019 at 20:59)</a>:</h4>
<p>Yeah</p>



<a name="161483379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483379">(Mar 22 2019 at 20:59)</a>:</h4>
<p>What sorts of problems do they cause?</p>



<a name="161483386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483386">(Mar 22 2019 at 20:59)</a>:</h4>
<p>In that function, I commented the line which collects region constraints for unification</p>



<a name="161483398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483398">(Mar 22 2019 at 20:59)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">crate</span><span class="w"> </span><span class="k">fn</span> <span class="nf">into_ex_clause</span><span class="p">(</span><span class="n">result</span>: <span class="nc">UnificationResult</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">ex_clause</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="n">ChalkExClause</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">ex_clause</span><span class="p">.</span><span class="n">subgoals</span><span class="p">.</span><span class="n">extend</span><span class="p">(</span><span class="w"></span>
<span class="w">        </span><span class="n">result</span><span class="p">.</span><span class="n">goals</span><span class="p">.</span><span class="n">into_iter</span><span class="p">().</span><span class="n">map</span><span class="p">(</span><span class="n">Literal</span>::<span class="n">Positive</span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="p">);</span><span class="w"></span>

<span class="w">    </span><span class="c1">// FIXME: restore this later once we get better at handling regions</span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">_</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">result</span><span class="p">.</span><span class="n">constraints</span><span class="p">.</span><span class="n">len</span><span class="p">();</span><span class="w"> </span><span class="c1">// trick `-D dead-code`</span>
<span class="w">    </span><span class="c1">// ex_clause.constraints.extend(result.constraints);</span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="161483427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483427">(Mar 22 2019 at 21:00)</a>:</h4>
<p>Well, they end up creating multiple identical solutions but with different region constraints</p>



<a name="161483478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483478">(Mar 22 2019 at 21:00)</a>:</h4>
<p>different syntactically but actually equivalent</p>



<a name="161483511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483511">(Mar 22 2019 at 21:00)</a>:</h4>
<p>But enough for the solver to answer ambiguity</p>



<a name="161483585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483585">(Mar 22 2019 at 21:01)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I’ve written down a precise example here in some stream, I’ll try to find it</p>



<a name="161483593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483593">(Mar 22 2019 at 21:01)</a>:</h4>
<p>That would be great</p>



<a name="161483873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161483873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161483873">(Mar 22 2019 at 21:05)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> check the « chalk-integration » stream, November 29th</p>



<a name="161485230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161485230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161485230">(Mar 22 2019 at 21:22)</a>:</h4>
<p>I see <a href="#narrow/stream/144729-wg-traits/topic/chalk-integration/near/152565323" title="#narrow/stream/144729-wg-traits/topic/chalk-integration/near/152565323">these messages</a>, giving evidence that I've asked you to refresh my memory before <span aria-label="stuck out tongue wink" class="emoji emoji-1f61c" role="img" title="stuck out tongue wink">:stuck_out_tongue_wink:</span></p>



<a name="161485249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/region%20constraints/near/161485249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/region.20constraints.html#161485249">(Mar 22 2019 at 21:22)</a>:</h4>
<p>I guess this is the <a href="#narrow/stream/144729-wg-traits/topic/chalk-integration/near/148806762" title="#narrow/stream/144729-wg-traits/topic/chalk-integration/near/148806762">initial comment</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>